#pragma once

#include <thrust/for_each.h>

template <typename Container,
          typename Function>
struct ForEach
{
  Container A;
  Function f;

  template <typename Range>
  ForEach(const Range& X, Function f)
    : A(X.begin(), X.end()),
      f(f)
  {}

  void operator()(void)
  {
    thrust::for_each(A.begin(), A.end(), f);
  }
  
  void reset(void)
  {
    // nothing to do
  }
};

